{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-01-07T13:55:33.955213Z",
     "start_time": "2025-01-07T13:55:33.947276Z"
    }
   },
   "source": [
    "import pandas as pd\n",
    "arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],\n",
    "          ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]\n",
    "tuples = list(zip(*arrays))\n",
    "index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])\n",
    "df = pd.DataFrame({'A': [1, 2, 3, 4, 5, 6, 7, 8],\n",
    "                   'B': [9, 10, 11, 12, 13, 14, 15, 16]},\n",
    "                  index = index)\n",
    "print(df)\n",
    "print(df.iloc[0,1])"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              A   B\n",
      "first second       \n",
      "bar   one     1   9\n",
      "      two     2  10\n",
      "baz   one     3  11\n",
      "      two     4  12\n",
      "foo   one     5  13\n",
      "      two     6  14\n",
      "qux   one     7  15\n",
      "      two     8  16\n",
      "9\n"
     ]
    }
   ],
   "execution_count": 2
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
